package com.sobot.kb;

import java.util.List;
import java.util.UUID;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.sobot.kb.dto.RptRobotVo;
import com.sobot.kb.service.RptRobotService;

public class SobotKbDbApplicationTests {

	public static void main(String[] args) {
		ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("shardingTables.xml");
		RptRobotService demoService = applicationContext.getBean(RptRobotService.class);
		RptRobotVo  robotVo =demoService.selectPageByCompanyId("2013e7d496bc43f4a439555c27aa892d");
		System.out.println(robotVo);
		List<RptRobotVo> selectPage = demoService.selectPage();
		for (RptRobotVo rptRobotVo : selectPage) {
			System.out.println(rptRobotVo);
		}
		for (int i = 0; i < 200; i++) {
			 robotVo= new RptRobotVo();
			robotVo.setCompanyId(UUID.randomUUID().toString().replaceAll("-",""));
			robotVo.setDocCount(20L);
			robotVo.setDocId("15adaa626266479a9c29337f28362cd1");
			robotVo.setSource(2);
			robotVo.setResultDate("2018-11-12 12:00:12");
			demoService.save(robotVo);
		}
		
		Long count = demoService.selectCountByDocId("15adaa626266479a9c29337f28362cd1");
		System.out.println(count);
		applicationContext.close();
	}

}
